class Draw {
    private int height; // 高度

    // 构造函数
    public Draw(int height) {
        this.height = height;
    }

    // 绘制三角形
    public void drawTriangle() {
        for (int i = 1; i <= height; ++i) {
            // 打印空格
            for (int j = 0; j < height - i; ++j) {
                System.out.print(" ");
            }
            // 打印星号
            for (int j = 0; j < 2 * i - 1; ++j) {
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }

    // 绘制正方形
    public void drawSquare() {
        for (int i = 0; i < height; ++i) {
            for (int j = 0; j < height; ++j) {
                System.out.print("* ");
            }
            System.out.println();
        }
        System.out.println();
    }

    // 绘制平行四边形
    public void drawParallelogram() {
        for (int i = 0; i < height; ++i) {
            // 打印空格
            for (int j = 0; j < height - i - 1; ++j) {
                System.out.print(" ");
            }
            // 打印星号
            for (int j = 0; j < height; ++j) {
                System.out.print("* ");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void main(String[] args) {
        // 创建对象并绘制三种形状
        Draw shape = new Draw(4);

        shape.drawTriangle();      // 绘制三角形
        shape.drawSquare();        // 绘制正方形
        shape.drawParallelogram(); // 绘制平行四边形
    }
}
